import Vue from 'vue'
import Router from 'vue-router'
import Login from './views/Login.vue'
import Register from './views/Register.vue'
import BottomNav  from './views/BottomNav.vue'  //底部导航栏

Vue.use(Router)

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/',
      name: 'index',
      redirect: '/login'
    },
    {
      path: '/login',
      name: 'login',
      component: Login
    },
    {
      path: '/register',
      name: 'register',
      component: Register
    },
    {
      path: '/index',
      name: 'idnex',
      component: () => import('./views/Index.vue')
    },
    {
      path: '/botNav',
      name: 'botNav',
      component: BottomNav,
      children: [
        {
          path: 'home',
          name: 'home',
          component: () => import('./views/Index.vue')
        },
        {
          path: 'category',
          name: 'category',
          component: () => import('./views/nav/Category.vue')
        },
        {
          path: 'search',
          name: 'search',
          component: () => import('./views/nav/Search.vue')
        },
        {
          path: 'cart',
          name: 'cart',
          component: () => import('./views/nav/Cart.vue')
        },
        {
          path: 'user',
          name: 'user',
          component: () => import('./views/nav/MyCenter.vue')
        }
      ]
    },
  ]
})
